<?php
$this->headTitle('List Product');
?>

<?php
if (isset($user)) {
    echo $this->partial('admin/header/wellcome.phtml', array('user' => $user));
}
?>

<ul class="nav nav-pills">
    <li><a href="<?php
        echo $this->url('product-admin/doaction', array(
            'controller' => 'product-admin-controller',
            'action' => 'add-product'));
        ?>"><h5>Thêm sản phẩm</h5></a>
    </li>
</ul>

<table class="table">
    <thead>
        <tr>
            <th>ID</th>
            <th>Tên sản phẩm</th>
            <th>Thông tin s.p</th>
            <th>Giá (VNĐ)</th>
            <th>Thao tác</th>
        </tr>
    </thead>
    <tbody>
        <?php foreach ($aryProduct as $key => $product) { ?>
            <tr>
                <td>
                    <?php echo $product['product_id']; ?>
                </td>
                <td>
                    <p style="padding-bottom: 5px;"><?php echo $product['product_name']; ?></p>
                    <p><img src="/upload/images/thumb/<?php echo $product['product_image']; ?>"></p>
                </td>
                <td>
                    <div class="row">
                        <div class="col-md-3">Danh mục</div>
                        <div class="col-md-6">
                            <a href="<?php
                            echo $this->url('product-admin/paginator', array(
                                'cat_filter' => $product['category_name_filter'],
                                'cat_id' => $product['product_category_id']
                            ));
                            ?>"><?php echo $product['category_name']; ?></a>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-md-3">Hãng SX</div>
                        <div class="col-md-6"><?php echo $product['product_maker_name']; ?></div>
                    </div>
                    <?php if ($product['product_type'] != 0) { ?>
                        <div class="row">
                            <div class="col-md-3">Loại SP</div>
                            <div class="col-md-6"><?php echo $productType[$product['product_type']]; ?></div>
                        </div>
                    <?php } ?>
                </td>
                <td>
                    <div class="row">
                        Giá gốc&nbsp: <?php echo number_format($product['product_price'], 0, ',', '.'); ?>₫
                    </div>
                    <div class="row">
                        Giá km&nbsp&nbsp: <?php echo number_format($product['product_price_sale_of'], 0, ',', '.') ?>₫
                    </div>
                </td>
                <td>
                    <a href="<?php echo $this->url('product-admin/doaction', array('controller' => 'product-admin-controller', 'action' => 'edit-product', 'param' => $product['product_id'])); ?>">Edit</a>
                    <a href="<?php echo $this->url('product-admin/doaction', array('controller' => 'product-admin-controller', 'action' => 'delete-product', 'param' => $product['product_id'])); ?>">Delete</a>
                </td>
            </tr>
        <?php } ?>
    </tbody>
</table>
<?php
echo $this->paginationControl($this->aryProduct, 'Sliding', 'admin/paginator/product-paginator.phtml', array(
    'route' => 'product-admin/paginator',
    'cat_id' => $category_id,
    'cat_filter' => $category_filter
));
?>